﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Subtle.Domain.Models;
using Subtle.Extensions;
using Subtle.Data.Extensions;

namespace Subtle.ViewModels
{
	/// <summary>
	/// Home Post View Model
	/// </summary>
	public class HomePostViewModel
	{
		public int ID { get; set; }
		public string Title { get; set; }
		public string LinkTitle { get { return Title.Sanitize(); } }
		public string Body { get; set; }
		public string Tags { get; set; }
		public string RelatedPosts { get; set; }
		public string CategoryDescription { get; set; }
		public string PublishDate { get; set; }
		public string Share { get; set; }

		/// <summary>
		/// Get Model
		/// </summary>
		/// <param name="post"></param>
		/// <returns></returns>
		public static HomePostViewModel GetModel(Post post)
		{
			HomePostViewModel homePostViewModel = new HomePostViewModel();
			if (post != null)
			{
				homePostViewModel = AutoMapper.Mapper.Map<Post, HomePostViewModel>(post, homePostViewModel);
			}
			return homePostViewModel;
		}
	}
}